package min.chapter.three;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ContainerClassAcquisition {

	public static void main(String[] args) {
		String[] parentConfigLocations = new String[] {"min/chapter/three/ContainerClassparent.xml" };
		AbstractApplicationContext parentContext = new ClassPathXmlApplicationContext(parentConfigLocations);
		String[] childConfigLocations = new String[] {"min/chapter/three/ContainerClassChild.xml" };
		AbstractApplicationContext childContext = new ClassPathXmlApplicationContext(childConfigLocations, parentContext);
		ContainerClass parentSender = parentContext.getBean("smsSender", ContainerClass.class);
		ContainerClass childSender = childContext.getBean("smsSender", ContainerClass.class);
		
		System.out.println("parentSender == childSender : " + (parentSender == childSender));
		ContainerClassSystemMonitor monitor = childContext.getBean("monitor", ContainerClassSystemMonitor.class);
		System.out.println(monitor);
	}
}
